package ipad.asia.service.express;

import ipad.asia.entity.Express;
import ipad.asia.service.express.fallback.ExpressFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;

@Component
@FeignClient(value = "PROVIDER-ORDER")
public interface ExpressFeign {
    /**
     * 商家查看自己的物流订单
     * @param shopId
     * @return
     */
    @RequestMapping("/express/getByShopId")
     List<Express> findByShopId(@RequestParam(value = "shopId") int shopId) ;

    /**
     * 顾客查看自己的物流订单
     * @param consumerId
     * @return
     */
    @RequestMapping("/express/getByConsumerId")
     List<Express> findByConsumerId(@RequestParam(value = "consumerId") int consumerId);

    /**
     * 商家输入物流
     * @param orderId
     * @param consumerId
     * @param shopId
     * @param expressName
     * @param expressNumber
     * @param departAddress
     * @param destAddress
     * @param date
     */
    @RequestMapping("/express/expressAdd")
     void expressAdd(@RequestParam(value = "orderId") int orderId,
                           @RequestParam(value = "consumerId") int consumerId,
                           @RequestParam(value = "shopId") int shopId,
                           @RequestParam(value = "expressName",required = false) String expressName,
                           @RequestParam(value = "expressNumber",required = false) String expressNumber,
                           @RequestParam(value = "departAddress",required = false) String departAddress,
                           @RequestParam(value = "destAddress",required = false) String destAddress,
                           @RequestParam(value = "date",required = false) Date date,
                           @RequestParam(value = "statues",required = false)int statues);

    @RequestMapping("/express/updateExpressStatue")
     void updateExpressStatue(@RequestParam(value = "statues",required = false) int statues,
                              @RequestParam(value = "id",required = false) int id);


    @RequestMapping("/express/getByOrderId")
     Express findByOrderId(@RequestParam(value = "orderId") int orderId) ;
}
